package com.example.helloworld;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class MainActivityHello extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_activity_hello);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main_activity_hello, menu);
        return true;
    }
    
    int i=0;
    public TextView mTextView;
    public void ButtonClick(View v){
    	setContentView(R.layout.activity_main_activity_hello);
    	mTextView = (TextView) findViewById(R.id.textView1);
    	if(i++==0) mTextView.setVisibility(View.VISIBLE);
    	else {i-=2;mTextView.setVisibility(View.GONE);}
    	//Toast.makeText(this, "Hello World!", Toast.LENGTH_SHORT).show(); 
    	
    	} 

    public void Turn(Context a, Class<?> b){
    	//Intent intent=new Intent(a,b);
    	//intent.setClass(a,b);
    	//startActivity(intent);
    	startActivity(new Intent(a,b));
    	overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
    }
    public void ButtonClick1(View v){
    	Turn(MainActivityHello.this,linear.class);
    }
    public void ButtonClick2(View v){
    	Turn(MainActivityHello.this,relative.class);
    }
    public void ButtonClick3(View v){
    	Turn(MainActivityHello.this,frame.class);
    }
    public void ButtonClick4(View v){
    	Turn(MainActivityHello.this,table.class);
    }
    public void ButtonClick5(View v){
    	Turn(MainActivityHello.this,listview.class);
    }
    public void ButtonClick6(View v){
    	Turn(MainActivityHello.this,custom_listview.class);
    }
    public void quit(View v){
    	Intent intent=new Intent(Intent.ACTION_MAIN);
    	intent.addCategory(Intent.CATEGORY_HOME);
    	intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    	startActivity(intent);
    	android.os.Process.killProcess(android.os.Process.myPid());
    }
}
